#ifndef COLLISION_MANAGER_H
#define COLLISION_MANAGER_H

#include "CollidableObject.h"
#include "DoubleDispatch.h"
#include "Singleton.h"

namespace Engine
{
	typedef std::pair <unsigned int, unsigned int> CollidableObjectIDPair;
	typedef std::function <void (CollidableObject*, CollidableObject*)> HandlerFunction;

	class CollisionManager : public NonCopyable
	{
		private:
			friend class Singleton <CollisionManager>;
			CollisionManager(){}
			typedef std::map <unsigned int, CollidableObject*> CollidableObjectMap;
			CollidableObjectMap m_map;

			typedef DoubleDispatch <unsigned int, CollidableObject> CollisionDoubleDispatch;
			CollisionDoubleDispatch m_doubleDispatch;

		public:
			void RegisterCollisionHandler(const CollidableObjectIDPair& pair, HandlerFunction func);
			void RegisterCollidableObject(CollidableObject* obj);
			void UnregisterCollidableObject(unsigned int id);
	};

	typedef Singleton <CollisionManager> TheCollisionManager;
}

#endif

